package com.beamfield.dao.material;

import java.util.List;

import com.beamfield.model.Demand;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import com.beamfield.model.PurchasePlan;

@Component
public interface PurchasePlanMapper {
	int deleteByPrimaryKey(Long purchase_plan_id);

	int insert(PurchasePlan record);

	int insertSelective(PurchasePlan record);

	PurchasePlan selectByPrimaryKey(Long purchase_plan_id);

	int updateByPrimaryKeySelective(PurchasePlan record);

	int updateByPrimaryKey(PurchasePlan record);

	List<PurchasePlan> selectByProjectId(@Param("projectId") String projectId,
                                         @Param("purchaseName") String purchaseName, @Param("purchaseState") String purchaseState,
                                         @Param("offset") String offset, @Param("limit") String limit,@Param("beamId") Long beamId);

	long countByProjectId(@Param("projectId") String projectId, @Param("purchaseName") String purchaseName,
						  @Param("purchaseState") String purchaseState, @Param("beamId") long beamId);

	List<PurchasePlan> selectPagePurchasePlan(@Param("beam_id") Long beamId,
                                              @Param("projectId") String projectId,
											  @Param("supplies_id") String supplies_id,
                                              @Param("purchaseName") String purchaseName,
                                              @Param("purchaseState") String purchaseState,
                                              @Param("offset") Integer offset,
                                              @Param("limit") Integer limit);

	/**
	 * 查询已经入库的材料数量且出通知结果且检验合格
	 * @date 2018年6月13日
	 * @author mintonzhang@163.com
	 * @param planId
	 * @param suppliesId
	 * @param inbound_id
	 * @return
	 */
	Double selectInboundSumNum(@Param("planId") Long planId, @Param("suppliesId") String suppliesId, @Param("manufacturer") String manufacturer,@Param("inbound_id")  Long inbound_id);
	Double selectInboundSumNumAndNotPass(@Param("planId") Long planId, @Param("suppliesId") String suppliesId);


	List<Demand> selectDistinctMonth(@Param("projectId") String projectId, @Param("beamId") long beamId);

	long countAllPurchase(@Param("beamid" )long beamid);
	long countCheckedPurchase(@Param("beamid")long beamid);
	long countPassPurchase(@Param("beamid")long beamid);
	long countSCheckedPurchase(@Param("beamid")long beamid);
	long countKindsOfSupplies(long beam);

	List<PurchasePlan> selectByDemandId(@Param("demandId") String demandId);

    long selectBySuppliesId(String suppliesId);
}
